//
//  EPConst.swift
//  EPMM
//
//  Created by liujianlong on 2022/7/27.
//

import Foundation
import UIKit
#if canImport(TCC_String)
import TCC_String
#endif
#if canImport(TCC_Extension)
import TCC_Extension
#endif
//MARK: - 获取屏幕大小
public let kUIScreenSize = UIScreen.main.responds(to: #selector(getter: UIScreen.nativeBounds)) ? CGSize(width: UIScreen.main.nativeBounds.size.width / UIScreen.main.nativeScale, height: UIScreen.main.nativeBounds.size.height / UIScreen.main.nativeScale) : UIScreen.main.bounds.size
public let kUIScreenWidth = kUIScreenSize.width
public let kUIScreenHeight = kUIScreenSize.height
public let kUIScreenBounds = UIScreen.main.bounds

//MARK: - 判断屏幕尺寸
public let kSCREEN_MAX_LENGTH = max(kUIScreenWidth, kUIScreenHeight)
public let kSCREEN_MIN_LENGTH = min(kUIScreenWidth, kUIScreenHeight)

//MARK: - 机型判断
public let kUI_IPHONE = (UIDevice.current.userInterfaceIdiom == .phone)
public let kUI_IPHONE5 = (kUI_IPHONE && kSCREEN_MAX_LENGTH == 568.0)
public let kUI_IPHONE6 = (kUI_IPHONE && kSCREEN_MAX_LENGTH == 667.0)
public let kUI_IPHONEPLUS = (kUI_IPHONE && kSCREEN_MAX_LENGTH == 736.0)
public let kUI_IPHONEX = (kUI_IPHONE && kSCREEN_MAX_LENGTH > 780.0)
let gap : CGFloat = 10.0
//MARK: - 获取状态栏、标题栏、导航栏高度
public let kUIStatusBarHeight: CGFloat = UIApplication.shared.statusBarFrame.size.height
public let kUINavigationBarHeight: CGFloat =  kUI_IPHONEX ? 88 : 64
public let KUITabBarHeight: CGFloat = kUI_IPHONEX ? 83 : 49
//MARK: - 自定义打印
public func MyPrint<T>(_ msg:T,file:String = #file, funcName:String = #function, lineNumber:Int = #line){
    let fileName = (file as NSString).lastPathComponent
    let formmater = DateFormatter()
    formmater.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS"
    let time =  formmater.string(from:Date())
    print("\(fileName)(\(lineNumber))-\(time):\(msg)")
}
//navigationBarHeight默认高度44 （iPhoneX 88）
//tabBarHeight默认高度49     （iPhoneX 83）

//适配 350 375 414       568 667 736
public func kAutoLayoutWidth(_ width: CGFloat) -> CGFloat {
    return width*kUIScreenWidth / 375
}
public func kAutoLayoutHeigth(_ height: CGFloat) -> CGFloat {
    return height*kUIScreenHeight / 667
}
public let BLEDIS = "蓝牙出问题了，快去检查一下吧～"
public let LocalCustomArrayKey = "LocalCustomArrayKey"

//MARK: - 获取颜色/字体
///大背景色
public let HEX_BG = "#ffffff"
/// 分割线
public let HEX_LINE = "#EEEEEE"
///灰色 文字
public let HEX_GRAY1 = "#CFCFCF"
/// 深灰色 文字
public let HEX_GRAY2 = "#9B9B9B"
///黑色  主要文字标题/文字按钮
public let HEX_BLACK = "#000000"
/// 橙色 消息提示/数据提示
public let HEX_ORANGE = "#fb5620"
/// 黄色 消息提示/数据状态
public let HEX_YELLOW = "#FFD300"
///绿色
public let HEX_GREEN = "#00E0D3"
///带点灰色蒙罩的绿色
public let HEX_GREEN2 = "#00C2B7"
///青色
public let HEX_BLUE = "#005BBA"
/// 墨青色
public let HEX_BLUE2 = "#092D74"
///主题红色
public let HEX_RED = "#C5283B"
///粗字体
public let FONT_B = "Oswald-Bold"
///细字体
public let FONT_L = "Oswald-Light"
///常规字体
public let FONT_R = "Oswald-Regular"
/// 日期/导航栏/标题
public let FONT_TITLE = UIFont(name:FONT_R, size: 16)!
/// 正文
public let FONT_TEXT = UIFont(name:FONT_R, size: 14)!
/// 设备提示/电量信息
public let FONT_TIP = UIFont(name:FONT_R, size: 12)!
public class EPConst: NSObject
{
    @objc static let KMScale = 0.6213
    @objc static let AppID_Bugly = "2f4a197df5"
    @objc static let mapKey = "583574adfe64de9673a33e24b904a119"
    @objc class func hexColor(_ hex : String) -> UIColor {return hex.color()}
}
